Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore "You are using [hist/kde] as a plot kind" warnings #342

Merged
merged 3 commits into from
Sep 27, 2023

Conversation

AdamOrmondroyd
Copy link
Collaborator

Description

Since the UserWarnings were added to prevent users from unintentionally using kde instead of kde_1d etc, the test suite has been (correctly) flagging up these warnings, affecting quality of life

Tests obviously won't pass until either #341 or #339 are merged.

Fixes # (issue)

Checklist:

  • I have performed a self-review of my own code
  • My code is PEP8 compliant (flake8 anesthetic tests)
  • My code contains compliant docstrings (pydocstyle --convention=numpy anesthetic)
  • New and existing unit tests pass locally with my changes (python -m pytest)
  • I have added tests that prove my fix is effective or that my feature works
  • I have appropriately incremented the semantic version number in both README.rst and anesthetic/_version.py

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (108d77c) 100.00% compared to head (a85e990) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #342   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           34        34           
  Lines         2858      2858           
=========================================
  Hits          2858      2858           
Files Changed Coverage Δ
anesthetic/_version.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lukashergt
Copy link
Collaborator

These are warnings that I'd argue should pop up in the tests, so they should not be suppressed, and they should "affect our quality of life"...

The warnings are bound to go away eventually with #320, but until then they are a good reminder that we should eventually clean this up fully.

@AdamOrmondroyd
Copy link
Collaborator Author

I agree they will go away with #320 as it stands, but should they? Unless we actually make hist and kde inaccessible through anesthetic they will still "look odd"

@lukashergt
Copy link
Collaborator

I agree they will go away with #320 as it stands, but should they? Unless we actually make hist and kde inaccessible through anesthetic they will still "look odd"

Agreed, it is probably good to keep them, but that means that rather than just filtering them out of the tests, we should make them part of the tests, i.e. make use of with pytest.warns(UserWarning):.

I see two ways of implementing this:

  1. Change all the tests that currently are filtering the warnings out to instead make use of pytest.warns in the appropriate cases.
  2. Keep the filtering as is, but add specific tests for the warnings.

What would others think best?

@AdamOrmondroyd
Copy link
Collaborator Author

AdamOrmondroyd commented Sep 22, 2023

Seeing as the filters don't appear that many times in the test suite, I think 1

Edit: ends up being a bit awkward since pytest.warns is a context, so contextlib.nullcontext is required to avoid repeating

Copy link
Collaborator

@lukashergt lukashergt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks @AdamOrmondroyd. Please, squash and merge if you think it is ready. And please feel free to hit "request review" to get a faster reaction from me.

@AdamOrmondroyd AdamOrmondroyd merged commit 96fad22 into handley-lab:master Sep 27, 2023
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants